/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package resoursePlan.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import resoursePlan.Person;
import resoursePlan.ResoursePlanPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Person</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link resoursePlan.impl.PersonImpl#getName <em>Name</em>}</li>
 *   <li>{@link resoursePlan.impl.PersonImpl#getCompetency <em>Competency</em>}</li>
 *   <li>{@link resoursePlan.impl.PersonImpl#getWorkload <em>Workload</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PersonImpl extends EObjectImpl implements Person {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getCompetency() <em>Competency</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCompetency()
	 * @generated
	 * @ordered
	 */
	protected static final String COMPETENCY_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getCompetency() <em>Competency</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCompetency()
	 * @generated
	 * @ordered
	 */
	protected String competency = COMPETENCY_EDEFAULT;

	/**
	 * The default value of the '{@link #getWorkload() <em>Workload</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getWorkload()
	 * @generated
	 * @ordered
	 */
	protected static final int WORKLOAD_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getWorkload() <em>Workload</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getWorkload()
	 * @generated
	 * @ordered
	 */
	protected int workload = WORKLOAD_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PersonImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ResoursePlanPackage.Literals.PERSON;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ResoursePlanPackage.PERSON__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getCompetency() {
		return competency;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCompetency(String newCompetency) {
		String oldCompetency = competency;
		competency = newCompetency;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ResoursePlanPackage.PERSON__COMPETENCY, oldCompetency, competency));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getWorkload() {
		return workload;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setWorkload(int newWorkload) {
		int oldWorkload = workload;
		workload = newWorkload;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ResoursePlanPackage.PERSON__WORKLOAD, oldWorkload, workload));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ResoursePlanPackage.PERSON__NAME:
				return getName();
			case ResoursePlanPackage.PERSON__COMPETENCY:
				return getCompetency();
			case ResoursePlanPackage.PERSON__WORKLOAD:
				return getWorkload();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ResoursePlanPackage.PERSON__NAME:
				setName((String)newValue);
				return;
			case ResoursePlanPackage.PERSON__COMPETENCY:
				setCompetency((String)newValue);
				return;
			case ResoursePlanPackage.PERSON__WORKLOAD:
				setWorkload((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ResoursePlanPackage.PERSON__NAME:
				setName(NAME_EDEFAULT);
				return;
			case ResoursePlanPackage.PERSON__COMPETENCY:
				setCompetency(COMPETENCY_EDEFAULT);
				return;
			case ResoursePlanPackage.PERSON__WORKLOAD:
				setWorkload(WORKLOAD_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ResoursePlanPackage.PERSON__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case ResoursePlanPackage.PERSON__COMPETENCY:
				return COMPETENCY_EDEFAULT == null ? competency != null : !COMPETENCY_EDEFAULT.equals(competency);
			case ResoursePlanPackage.PERSON__WORKLOAD:
				return workload != WORKLOAD_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(", competency: ");
		result.append(competency);
		result.append(", workload: ");
		result.append(workload);
		result.append(')');
		return result.toString();
	}

} //PersonImpl
